<template>
<div>
  <el-table :data="importarray" border style="width: 80%">
    <el-table-column
      align="center"
      prop="paymentPluginName"
      label="支付插件名称"
      width="180"
    >
    </el-table-column>
    <el-table-column align="center" prop="status" label="进件状态" width="180">
      <template slot-scope="scope">
        <el-tag :type="scope.row.status==3?'danger':'success'">{{ scope.row.status | watchSubType }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      align="center"
      prop="cerateDated"
      label="审核日期"
      width="250"
    >
      <template slot-scope="scope">
        <span>{{ scope.row.createDate | datetimeFormatter }}</span>
      </template>
    </el-table-column>
    <el-table-column prop="remark" align="center" label="审核备注">
    </el-table-column>
    <el-table-column align="center" label="操作">
      <template slot-scope="scope">
        <el-button type="primary" size="mini" @click="wxImport" v-if="scope.row.status==0||scope.row.status==3">进件</el-button>
        <el-button type="primary" size="mini" v-if="scope.row.status==2||scope.row.status==1" @click="codeshowfunction">显示签约链接二维码</el-button>
        <el-button type="primary" size="mini" @click="wxSelectApply" >查询</el-button>
      </template>
    </el-table-column>
  </el-table>
   <el-dialog
      title="请选择具体位置"
      :visible.sync="codeShow"
      top="5vh"
      width="50%"
      :before-close="handleClose"
    >
        <div style="width:100%;display: flex;
    justify-content: center;
    align-items: center;">
          <img :src="signUrl" alt="">
        </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleClose">确 定</el-button>
      </span>
    </el-dialog>
  
</div>

  
</template>

<script>

import {
  wxImport,
  wxSelectApply,
  
} from "@/api/sysMch";
import { thumbnail_pad } from '@/filters';
export default {
  data() {
    return {
        importform:{},
        importarray:[],
        statustype:null,
        codeShow:false,
        signUrl:""
    };
  },
        filters: {
      watchSubType(val) {
        if (val == 0) {
          return '待提交'
        } else if (val == 1) {
          return '已提交'
        } else if (val == 2) {
          return '已审核'
        } else if (val == 3) {
          return '已驳回'
        }
      }},
  created(){
      this.wxSelectApply()
  },
  methods: {
    codeshowfunction(){
      this.codeShow=true
    },

handleClose(){
  this.codeShow=false

},
    wxSelectApply() {
      this.importarray=[]
      wxSelectApply().then((res) => {
        this.importform = res.data;

        this.importarray.push(this.importform);
        this.signUrl=res.data.signUrl
      });
    },
    wxImport() {
        var _this=this
      this.$confirm("确定要进件吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        wxImport().then((res) => {
          if (res.type == "success") {
            _this.$message({ type: "info", message: res.data.remark });
            _this.wxSelectApply();
          }
        });
      });
    },
  },
};
</script>
 <style>
</style>